<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
	<title>房间列表</title>
	<base href="<%=basePath%>"> 
	<!--[if lt IE 9]>
	<script type="text/javascript" src="js/html5.js"></script>
	<script type="text/javascript" src="js/respond.min.js"></script>
	<script type="text/javascript" src="js/PIE_IE678.js"></script>
	<![endif]-->
	<link rel="stylesheet" href="js/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
	<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
	<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
	<link rel="stylesheet" type="text/css" href="js/Hui-iconfont/1.0.7/iconfont.css" />
	<link rel="stylesheet" type="text/css" href="js/icheck/icheck.css" />
	<link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
	<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
	<link rel="stylesheet" type="text/css" href="css/vivo.css" />
	<!--[if IE 6]>
	<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
	<script>DD_belatedPNG.fix('*');</script>
	<![endif]-->
	
	
	<script type="text/javascript" src="js/jquery-1.11.1.js"></script> 
	<script type="text/javascript" src="js/layer/layer/layer.js"></script> 
	<script type="text/javascript" src="js/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
 	<!-- grid.simple.min.css, grid.simple.min.js -->
	<link rel="stylesheet" href="js/grid/bsgrid.all.min.css"/>
	<script type="text/javascript" src="js/grid/grid.zh-CN.min.js"></script>
	<script type="text/javascript" src="js/grid/bsgrid.all.min.js"></script>
	<script type="text/javascript" src="js/sharefunction.js"></script>
	 <script type="text/javascript" src="js/init.js"></script>
	<script language="javascript">
		var rMenu="";
		var zTree="";
		var zTreeObj;
		var infoId = "";
		var state="0";
		$(document).ready(function(){
		    zTreeObj = initTree("treeDemo","project/roomInfo/treeJson");
		    zTree = $.fn.zTree.getZTreeObj("treeDemo");
		    rMenu = $("#rMenu");
		    if(infoId==""||infoId==null){
			    $("#btn_add").hide();
			}
		});
		
		//树点击前执行的方法
		function beforeClick(){
		
		}
		
		  //右键执行的方法
		function OnRightClick(event, treeId, treeNode) {
		    //treeNode.id 树的id
		    zTree.selectNode(treeNode);
		}
		
		var level = ""
		function onClick(e, treeId, treeNode){
			$("#btn_add").hide();
			var params="";
			var pInfoId = "";
			var level = treeNode.level;
			if(level==2){
				infoId = treeNode.id;
				params = "&infoId="+infoId+"&state="+state;
			}else if(level==1){
				pInfoId = treeNode.id;
				params ="&pInfoId="+pInfoId+"&state="+state;
				
			}
			gridObj.options.otherParames=params;
			gridObj.refreshPage(); 
		}

		function doSearch(treeNode){
			var params = "";
			
			var roomNumber = $("#roomNumber").val();
			params = "&infoId="+infoId+"&roomNumber="+roomNumber;
			gridObj.options.otherParames = params;
			gridObj.refreshPage();
			$("#roomNumber").val("");
			
			
		}


	</script>

  </head>
  
  <body >
    <div id="main" class="main" style="height:100%">
    <div id="tree" class="ztree-left">
	   <ul id="treeDemo" class="ztree"></ul>
	</div>
	
	<div id="lay-right" class="lay-right" style="height: 459px;">
	<div style="padding:1px"></div>
		<div class="cl pd-5 bg-1 bk-gray" style="height: 34px;margin: 8px 19px 10px 0px;">
			房间号码
			<input type="text" name="roomNumber" id="roomNumber" size="15">
			
			&nbsp; <a   class='btn btn-primary radius' onClick=doSearch() ><span class="glyphicon glyphicon-search"></span>查 询</a>
		</div>
		
	
	<table id="searchTable" width="100%">
		<tr>
			<th w_index="no" width="5%;" >序号</th>
			<th w_index="roomNumber"  width="5%;">房间号</th>
			<th w_index="datails" width="10%;" w_render="Data">操作</th>
			<th w_hidden="true" w_index="id" >id</th>
			<th w_hidden="true" w_index="typeChoice" >attId</th>
			<th w_hidden="true" w_index="addUserid" >addUserid</th>
		</tr>
	</table>
	<script type="text/javascript">
				var gridObj;
				$(function () {
					gridObj = $.fn.bsgrid.init('searchTable', {
						url: "project/roomInfo/getRoomInfoJsonData",
						autoLoad: true,
						pageSizeSelect: false, 
						multiSort: true ,
						displayBlankRows: false ,
						pagingLittleToolbar: true,
						stripeRows: true,
						rowHoverColor: true,
						pageSize: 10,
						otherParames:{"infoId":infoId,"state":state},
						curPage:1
					});
				});
				//操作
				function Data(record, rowIndex, colIndex, options) {
					var html="";;
					var id = gridObj.getRecordIndexValue(record, 'id');
					var elementids2 = $("#sys_permissionids").val();
					var sys_user_id=$("#sys_user_id").val();
					var addUserid = gridObj.getRecordIndexValue(record, 'addUserid');
					var sys_userid = $("#sys_userid").val();
					if(elementids2.indexOf("customer_profile_choose_a_room_btn_ok")!=-1 ||addUserid.indexOf(sys_userid)!=-1 ||addUserid.indexOf(sys_user_id)!=-1){
						html=" <a href=javascript:selOk('"+id+"')>确定</a>"
					}else{
						html = "<a style='cursor:text'>--</a>";
					} 	
					
				
					return html;
				}
				
				//显示详情 
				function selOk(id) {
								var customerId = parent.$("#id").val();
								var ye= parent.$("#ye").val();
								//alert(ye);
								var sortNum = $("#sortNum").val();
								var id=id;
								var url="customer/customerCheckin/form3/"+id+"_"+customerId+"_"+ye+"_"+sortNum;
								openTitleLayer("选择入住时间和是否需要二装",url,600,350);
							}
				
				
				function selOk1(ye,customerId){
					//alert(ye);
							if(ye!="1"){
								params ="&customerId="+customerId;
							//	alert(params);
								window.parent.gridObjCheckin.options.otherParames=params;
								window.parent.gridObjCheckin.refreshPage();
							}else{
								params="&state=1";
							//	alert(params);
								window.parent.gridObj.options.otherParames=params;
								window.parent.gridObj.refreshPage();
							}
							window.parent.checkoutroomcheckinClose();
							
				}
					
							
				
			</script>
		</div>
	<input type="hidden" id="checkColse" name="checkColse">
</div>
<jsp:include page="../common-field.jsp"></jsp:include>
</body>
</html>
	
	

